package com.mi.system.dto.request;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * Menu request DTO
 *
 * @author jin_huaquan
 * @version 1.0
 * @date 2021/11/3 11:05
 */
@ApiModel(value = "MenuRequestDTO对象", description = "字典请求信息")
@Data
public class MenuRequestDTO {

    @ApiModelProperty(value = "菜单标题", required = true)
    @NotBlank(message = "菜单标题不能为空")
    @Length(min = 1, max = 32, message = "菜单标题不能超过32个字符")
    private String name;

    @ApiModelProperty("菜单路由地址")
    @Length(max = 64, message = "菜单路由地址不能超过64个字符")
    private String path;

    @ApiModelProperty("菜单权限")
    @Length(max = 64, message = "菜单权限标识不能超过64个字符")
    private String permission;

    @ApiModelProperty(value = "父菜单ID", required = true, dataType = "java.lang.String")
    @NotNull(message = "父菜单的ID不能为空")
    private Long parentId;

    @ApiModelProperty("菜单图标")
    @Length(max = 32, message = "菜单图标不能超过32个字符")
    private String icon;

    @ApiModelProperty("菜单组件标识")
    @Length(max = 64, message = "菜单组件标识不能超过64个字符")
    private String component;

    @ApiModelProperty(value = "排序值", required = true)
    @NotNull(message = "排序值不能为空")
    private Integer sort;

    @ApiModelProperty(value = "是否缓存该页面 @enum MenuKeepAlive[0(否),1(是)]", required = true)
    @NotNull(message = "是否缓存该页面值不能为空")
    @Range(min = 0, max = 1, message = "是否缓存该页面数值非法")
    private Integer keepAlive;

    @ApiModelProperty(value = "菜单类型 @enum MenuType[0(目录),1(页面),2(按钮)]", required = true)
    @NotNull(message = "菜单类型不能为空")
    @Range(min = 0, max = 2, message = "菜单类型值非法")
    private Integer type;

    @ApiModelProperty(value = "是否隐藏 @enum MenuHidden[0(否),1(是)]", required = true)
    @NotNull(message = "是否隐藏不能为空")
    @Range(min = 0, max = 1, message = "是否隐藏值非法")
    private Integer hidden;

    @ApiModelProperty(value = "是否外链 @enum MenuTarget[0(否),1(是)]", required = true)
    @NotNull(message = "是否外链不能为空")
    @Range(min = 0, max = 1, message = "是否外链值非法")
    private Integer target;

    @ApiModelProperty(value = "是否启用 @enum MenuEnabled[0(否),1(是)]", required = true)
    @NotNull(message = "是否启用不能为空")
    @Range(min = 0, max = 1, message = "是否启用值非法")
    private Integer enabled;
}
